<extend name="base/Base" />
<block name="Style">
<!-- FooTable Plugin CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/vendor/plugins/footable/css/footable.core.min.css">
		<!-- Admin Forms CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/assets/admin-tools/admin-forms/css/admin-forms.css">
	
</block>
<block name="Topbar">
								
   <header id="topbar" class="ph10">
        <div class="topbar-left">
          <ul class="nav nav-list nav-list-topbar pull-left">
           
			<li    >
              <a href="__APP__/CMS/Article/Create.html"    >新增文章</a>
            </li>
			<li   class="active"  >
              <a  href="__APP__/CMS/Article/Manage.html"   >文章管理</a>
            </li>
			
           
          </ul>
        </div>
		<div class="topbar-right hidden-xs hidden-sm">
		 <a href="#"  onclick="selectAll()" class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star pr5"></span>全选</a>
			 <a href="#"   onclick="unSelect()"  class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star-o pr5"></span>不选</a>
			 <a href="#"    onclick="reverse()"class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star-half-o pr5"></span>反选</a>
			  
			
			 <a href="#" onclick="status(1)" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-arrow-circle-up pr5"></span>展示</a>
			 <a href="#"  onclick="status(2)"class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-arrow-circle-down pr5"></span>隐藏</a>
			<a href="#" onclick="status(0)" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-trash-o pr5"></span>删除</a>
			
			
			 
						  
          
        </div>
	</header>
	
	<div class="modal fade" id="usermyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
									  <div class="modal-dialog" role="document">
										<div class="modal-content">
										  <div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
											<h4 class="modal-title" id="myModalLabel">关系管理</h4>
										  </div>
										  <div class="modal-body">
											<div class="form-group">
												<label for="exampleInputEmail1">请输入用户UID</label>
												<input type="text" name="r_uid" id="r_uid" class="form-control"  placeholder="请输入用户UID">
											  </div>
											  
										
											<div class="form-group">
												<label for="exampleInputEmail1">请输入操作类型</label>
												<br>
												<label class="radio-inline">
												  <input type="radio" checked name="r_type" id="r_type" value="1"> 增加关联
												</label>
												<label class="radio-inline">
												  <input type="radio" name="r_type" id="r_type" value="2"> 删除关联
												</label>
												
												
											  </div>
											
											  
											
											
														
														
														
													
												
																
						
										  </div>
										  <div class="modal-footer">
											<button type="button" class="btn btn-default" data-dismiss="modal">关闭文章</button>
											<a href="#" class="btn btn-primary" onclick="relevance()" >确认操作</a>
															<script>
						
							
							function relevance(){  
								var uid = $("#r_uid").val();
								var group = $("#r_group").val();
								var type = $("input[name='r_type']:checked").val();;
							
								if(uid==''){
								
									layer.msg('请输入用户UID');
								
								}else{
								
									
									$.ajax({
										type:'POST',
										url:"__APP__/Admin/User/Relevance.html",
										data:{
											"uid": uid,
											"type": type,
											"group": group,
										
										},
										success:function(data){			
											var info = eval(data)
											if (info.errcode == 0) {
											
												layer.msg(info.errmsg);
												setTimeout(window.location.reload(),3000);
												
											}else{
												layer.msg(info.errmsg);
											}
										},
								
									});	
								
								}
								
								
								 
							}  
							</script>
										  </div>
										</div>
									  </div>
									</div>
	
				
</block>
<block name="Content">
	<!-- begin: .tray-center -->
        <div class="tray tray-center">

						
         	<script>
						
					function notice(msg){  
						layer.msg(msg);
					}	
							
							
							</script>
          <!-- recent orders table -->
          <div class="panel">
            <div class="panel-menu p12 admin-form theme-primary">
              <div class="row">
                <div class="col-md-10">
                  <label class="field select">
                    <select id="form_id" name="filter-category" >
                   
					  
						  <option value="0" selected="selected">全部分类</option>
						  
						 
				  
                      <volist name="classifys" id="classifys">
					  <optgroup label="{$classifys.name}">
					  <if condition="$classifys.down eq null "> 
						  <if condition="$classifys.id eq $form_id"> 
							<option value ="{$classifys.id}" selected>|-- {$classifys.name}</option>
						  <else />
							 <option value ="{$classifys.id}" >|-- {$classifys.name}</option>
						  
							</if>					  
					  <else /> 
					
						<foreach name="classifys.down" item="down" >
						<if condition="$down.id eq $form_id"> 
							
						<option value ="{$down.id}" selected>|-- {$down.name}</option>
						<else />
						<option value ="{$down.id}" >|-- {$down.name}</option>
						</if>
						</foreach>
						  </if>
					  </optgroup>
					</volist>
                    </select>
                    <i class="arrow"></i>
                  </label>
                </div>
				
              
				
                <div class="col-md-2">
                  <label class="field select">
                    <select id="status" name="bulk-action">
					  <if condition="$status eq 1"> 
				  
				  <option value="0" >全部状态</option>
				  <option value="1" selected>展示中</option>
                      <option value="2">隐藏中</option>
				  <elseif condition="$status eq 2"/>
				   <option value="0">全部状态</option>
				  
				   <option value="1" >展示中</option>
                      <option value="2" selected>隐藏中</option>
				  <else /> 
				  
				   <option value="0" selected="selected">全部状态</option>
				  <option value="1" >展示中</option>
                      <option value="2">隐藏中</option>
				  </if>
                     
                    
                      
                     
                    </select>
                    <i class="arrow double"></i>
                  </label>
                </div>
              </div>
            </div>
            <div class="panel-body pn" id="batchstatus">
			

              <div class="table-responsive">
                <table class="table footable"  data-filter="#fooFilter"  data-page-navigation=".pagination" data-page-size="100" >
                  <thead>
                    <tr class="bg-light"> 
					 
					 <th style="width:5%">批量</th>
					 <th style="width:5%">#</th>
                     
                     <th data-hide="phone,tablet">文章</th>
                     <th data-hide="phone,tablet">分类</th>
                     <th data-hide="phone,tablet">图片</th>
                     <th data-hide="phone,tablet">作者</th>
                     <th data-hide="phone,tablet">发表时间</th>
					 <th data-hide="phone,tablet">操作员</th>
					
				
                      <th data-hide="phone,tablet">操作</th>
													
                      
                    </tr>
                  </thead>
                  <tbody>
				  <volist name="list" id="list">
                    <tr>
						<td class="text-center">
						<if condition="$list.id eq 1"> 
						
						<else /> 
						<center>
						<label class="option block mn">
						  <input type="checkbox" id="batch" name="batch" value="{$list.id}">
						
						</label>
						</center>
						
						</if>
													
														
														
													  </td>
						<td class="">{$i}</td>
						<td class="">{$list.name}(AID:{$list.id})</td>
						<td class="">{$list.channel}</td>
						<td class=""><img src="{$list.img}" style="width:30px;height:30px;"></td>
                      
                     	
                     <td class="">
                     {$list.author}
					 </td>
				 <td >{$list.time|date="Y-m-d",###}</td>
					  
					    <td class="">
                        <img class="img-responsive mw30 ib mr10" title="user" src="{$list.n_img}">{$list.nickname}(UID:{$list.uid})
                      </td>
                       <td>
					   <if condition="$list.id eq 1"> 
						
						<else /> 
						
						
						
							<div class="btn-group text-right">
						
						
						<if condition="$list.status eq 1"> 
						<button type="button" class="btn btn-success br2 btn-xs fs12 dropdown-toggle" data-toggle="dropdown" aria-expanded="false">展示中
						
						<else /> 
						<button type="button" class="btn btn-warning br2 btn-xs fs12 dropdown-toggle" data-toggle="dropdown" aria-expanded="false">隐藏中
						
						</if>
                          

						   <span class="caret ml5"></span>
                          </button>
                          <ul class="dropdown-menu" role="menu">
							
							<li >
                              <a  href="__APP__/CMS/Article/Edit/id/{$list.id}.html" target="_blank" >编辑</a>
                            </li>
                          
                            
								
								
						    <li class="divider"></li>
							 <li >
                              <a  href="__APP__/CMS/Article/Detail/id/{$list.id}.html" target="_blank" >查看</a>
                            </li>
						
                         
                          
							
                           
                          </ul>
                        </div>
						  </if>
						</td>
                          
							
                           
                      
                    </tr>
                </volist>
				</tbody>
				 <tfoot class="footer-menu">
				<tr>
				  <td colspan="12">
					<nav class="text-right">
					  <ul class="pagination hide-if-no-paging"></ul>
					</nav>
				  </td>
				</tr>
			  </tfoot>
                </table>
              </div>
            </div>
          </div>

		  
				<div class="col-md-12 digg">
				 <br>
					<center>
				 {$pages}
				</center>
				
			  </div>
			  
        </div>
        <!-- end: .tray-center -->

        <!-- begin: .tray-right -->
        <aside class="tray tray-right tray290" data-tray-height="match">
		<form action="__SELF__" method="get">
          <!-- menu quick links -->
          <div class="admin-form">

            <h4>搜索文章</h4>
			提示：<span style="color:red;">为空时则不作为搜索条件</span>

            <hr class="short">
			
			<div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <input type="text" name="name" id="name" class="gui-input" placeholder="请输入文章标题" value="{$name}">
                <label for="order-id" class="field-icon">
                  <i class="fa fa-flag"></i>
                </label>
              </label>
            </div>
			
			<div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <input type="text" name="author" id="author" class="gui-input" placeholder="请输入文章作者" value="{$author}">
                <label for="order-id" class="field-icon">
                  <i class="fa fa-flag"></i>
                </label>
              </label>
            </div>
			
            <div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <input type="text" name="uid" id="uid" class="gui-input" placeholder="请输入发布者UID" value="{$uid}">
                <label for="order-id" class="field-icon">
                  <i class="fa fa-user"></i>
                </label>
              </label>
            </div>
		
			
			
			
            <h5><small>请选择开始时间	</small></h5>
            <div class="section row mb15">
              <div class="col-md-12">
                <label for="price1" class="field prepend-icon">
				  <input name="begin_time" placeholder="请输入日期" value='{$begin_time|date="Y-m-d",###}' class="laydate-icon gui-input" onclick="laydate()">
                  <label for="price1" class="field-icon">
                    <i class="fa fa-calendar"></i>
                  </label>
                </label>
              </div>
              
            </div>
			
			 <h5><small>请选择结束时间	</small></h5>
            <div class="section row mb15">
              <div class="col-md-12">
                <label for="price1" class="field prepend-icon">
				  <input name="end_time" placeholder="请输入日期" value='{$end_time|date="Y-m-d",###}' class="laydate-icon gui-input" onclick="laydate()">
                  <label for="price1" class="field-icon">
                    <i class="fa fa-calendar"></i>
                  </label>
                </label>
              </div>
              
            </div>

			 <h5><small>请选择文章分类</small></h5>
            <div class="section mb15">
              <label class="field select">
                <select id="filter-categories" name="form_id">
				
               
				  <option value="0" selected="selected">全部分类</option>
				  
				 
                  <volist name="classify" id="classify">
					  <optgroup label="{$classify.name}">
					  <if condition="$classify.down eq null "> 
					  <if condition="$classify.id eq $form_id"> 
						
						<option value ="{$classify.id}" selected>|-- {$classify.name}</option>
					  <else /> 
					  	<option value ="{$classify.id}">|-- {$classify.name}</option>
					  
					  </if>
					  <else /> 
					
						<foreach name="classify.down" item="down" >
						<if condition="$down.id eq $form_id"> 
							
						<option value ="{$down.id}" selected>|-- {$down.name}</option>
						<else />
						<option value ="{$down.id}" >|-- {$down.name}</option>
						</if>
						</foreach>
						  </if>
					  </optgroup>
					</volist>
                </select>
                <i class="arrow double"></i>
              </label>
            </div>
			 <h5><small>请选择文章状态</small></h5>
            <div class="section mb15">
              <label class="field select">
                <select id="filter-categories" name="status">
				
                 <if condition="$sdata eq null"> 
				  
				  <option value="0" selected="selected">全部状态</option>
				  
				  <else /> 
				   <option value="{$sdata.id}" selected="selected">{$sdata.name}</option>
				   <option value="0" >全部状态</option>
				  
				  </if>
                    <option value="1">展示中</option>
					<option value="2">隐藏中</option>
                 </select>
                <i class="arrow double"></i>
              </label>
            </div>
			

			
            <hr class="short">

            <div class="section">
                <button class="btn btn-default btn-sm ph25" type="submit" style="width:100%;">搜索文章</button>
               
            </div>

          </div>
		</form>
        </aside>
        <!-- end: .tray-right -->

   

</block>
<block name="Script">
	
  <!-- FooTable Plugin -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.all.min.js"></script>
   <!-- FooTable Addon -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.filter.min.js"></script>

 <script type="text/javascript">
 
	
		function unSelect(){
				
		  $("input[id='batch']").each(function(){
		   $(this).prop("checked",false);
		  });  
		  
	
		}
		
		function selectAll(){
				
		 $("input[id='batch']").each(function(){
		   $(this).prop("checked",true);
		  });  
		  
		}
		
		function reverse(){
				
		 $("input[id='batch']").each(function(){
			$(this).prop("checked",!this.checked);   
		  
			})
		}
		
			
				
				
			
		
				function status(status){
				
				
						 var id=$('input[id="batch"]:checked').map(function(){return this.value}).get().join();
						
						layer.confirm('你确定要这样做么？', {
						  btn: ['确定','取消'] //按钮
						}, function(){
						  
						  $.ajax({
								type:'POST',
								url:"__APP__/CMS/Article/Delete.html",
								data:{
									
									"id": id,
									"status": status,
									
								},
								success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
								},
								error:function(){
									layer.msg('系统繁忙,请稍候重试！');
								}
							
							});	 
						  
						}, function(){
						  
						  
						});

					
				
				}
				
				
					$("#form_id").change(function(){
						  	var form_id = $("#form_id").val();
							
							
							var url = '__APP__/CMS/Article/Manage.html';
							url = url+'?form_id='+form_id;
						
							 self.location=url;
							
						
						
					});
					
					
						$("#status").change(function(){
						  	var status = $("#status").val();
							
							
							var url = '__APP__/CMS/Article/Manage.html';
							url = url+'?status='+status;
						
							 self.location=url;
							
						
						
					});
					
						
					
  jQuery(document).ready(function() {

 

    // Init FooTable Examples
    $('.footable').footable();


  });
  </script>
</block>